package com.lottery.material.dao.transaction;

import com.lottery.material.pojo.transaction.TransactionRecord;
import com.lottery.material.vo.portal.transaction.TradeRecordStatisticsVo;
import com.lottery.material.vo.portal.transaction.TradeRecordVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @description 交易记录Mapper
 * @author rambo
 * @date 2019年4月17日 下午7:05:06
 */
@SuppressWarnings("JavaDoc")
public interface TransactionRecordMapper {

    Integer deleteByPrimaryKey(Integer id);

    Integer insert(TransactionRecord record);

    Integer insertSelective(TransactionRecord record);

    TransactionRecord selectByPrimaryKey(Integer id);

    Integer updateByPrimaryKeySelective(TransactionRecord record);

    Integer updateByPrimaryKey(TransactionRecord record);

    /**
     * description: 根据对象参数查询记录数
     * author sunny
     * createDate 2019-04-17 上午 11:15
     * @param transactionRecord
     * @return
     */
    Integer findCountByObject(TransactionRecord transactionRecord);

    /**
     * 交易记录统计
     * @Author 焦阳
     * @param map
     * @return
     */
    TradeRecordStatisticsVo findTradeRecordStatistics(Map<String, Object> map);

    List<TradeRecordVo> findTradeRecordByUserId(Map<String, Object> map);

    /**
     * description: 根据交易类型编号和文章id统计次数和总额
     * author sunny
     * createDate 2019-04-24 上午 9:40
     * @param transactionTypeCode
     * @param articleId
     * @return
     */
    Map<String, Object> findByTypeCodeAndArticleId(@Param("transactionTypeCode") String transactionTypeCode, @Param("articleId") String articleId);

    /**
     * description: 根据文章id分页查询付款查看文章明细
     * author sunny
     * createDate 2019-04-26 上午 11:30
     * @param paramMap
     * @return
     */
    List<Map<String, Object>> findPaymentDetailByArticleId(Map<String, Object> paramMap);

    /**
     * description: 根据文章id分页查询打赏文章明细
     * author sunny
     * createDate 2019-04-26 下午 2:18
     * @param paramMap
     * @return
     */
    List<Map<String, Object>> findRewardDetailByArticleId(Map<String, Object> paramMap);

    /**
     * description: 根据用户id和文章id查询查看文章记录
     * author sunny
     * createDate 2019-04-24 下午 8:55
     * @param userId
     * @param articleId
     * @return
     */
    TransactionRecord findViewArticleByUserIdAndArticleId(@Param("userId") String userId, @Param("articleId") String articleId);
}
